package com.rran.study.designpattern.behavioral.template.enums;

import lombok.Getter;

@Getter
public enum ShoppingPersonEnum {

    PERSON_A("PERSON_A","personASpringGoShopping"),
    PERSON_B("PERSON_B","personBSpringGoShopping"),
    PERSON_C("PERSON_C","personCSpringGoShopping"),
    ;

    String type;
    String beanName;

    ShoppingPersonEnum(String type, String beanName) {
        this.type = type;
        this.beanName = beanName;
    }

    public static String getBeanNameByType(String type) {
        for (ShoppingPersonEnum value : values()) {
            if (value.getType().equals(type)) {
                return value.beanName;
            }
        }
        return null;
    }
}
